<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@ page import="java.sql.*" %>
    <%@page import="com.DBtools"%>
   
<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<%@ include file="../bootstrap.jsp"%>
	<title >修改记录</title>
	<link href="style.css" rel="stylesheet" type="text/css"/>
	<style>
	.jacky{
	width:300px;
	height:400px;
	border:1px solid #000;
	text-align:center;
	
	}
	</style>
</head>
<%
//获得用户数据，主键，标记修改记录条件
 String teaId=(String)request.getSession().getAttribute("UserNum");

String teaName="",teaGender="",teaEmail="",teaAge="",depName="";
boolean modify=false;

if(teaId!=null && teaId.length()>0){
	//查询当前记录数据
	ResultSet rs = new DBtools().query("select * from teacher where TeaId=" + teaId);
	if(rs.next()){
		teaName = rs.getString("TeaName");
		teaGender = rs.getString("TeaGender");
		teaEmail = rs.getString("Teaemail");
		teaAge = rs.getString("TeaAge");
		depName = rs.getString("DepName");
	}
	rs.close();
	modify=true;
}else{
	//新增模式
	teaId = "";
}
%>
<body>
<h1 align=center>修改教师资料</h1>
<hr>
	<form  method="post" action="../ServletUpdateTeaInfo">
	
		<table width="600"  height="400" align="center" border="1" class="imagetable">
		<tr>
				<td width=100 class="p-3 mb-2 bg-light text-dark">教师号</td>
				<td><input class="form-control form-control"  type="text" name="id" value="<%=teaId%>" <%=(modify? "readonly" : "")%>/></td>
			</tr>
		<tr>
				<td width=100 class="p-3 mb-2 bg-light text-dark">姓名：</td>
				<td><input class="form-control form-control"  type="text" name="name" value="<%=teaName%>" <%=(modify? "readonly" : "")%>/></td>
			</tr>
		<tr>
				<td width=100 class="p-3 mb-2 bg-light text-dark">性别：</td>
				<td><input class="form-control form-control" type="text" name="sex" value="<%=teaGender%>" <%=(modify? "readonly" : "")%>/></td>
			</tr>
			<tr>
				<td width=100 class="p-3 mb-2 bg-light text-dark">邮箱：</td>
				<td><input class="form-control form-control" type="text" name="email" value="<%=teaEmail%>" /></td>
			</tr>
			<tr>
				<td width=100 class="p-3 mb-2 bg-light text-dark">年龄：</td>
				<td><input class="form-control form-control"  type="text" name="age" value="<%=teaAge%>"/></td>
			</tr>
			<tr>
				<td width=100 class="p-3 mb-2 bg-light text-dark">学院：</td>
				<td align=center><input  class="form-control form-control" type="text" name="dep" value="<%=depName%>"/></td>
				
			</tr>
			<tr>
				<td></td>
				<td align=center><input width=70 height=40 class="btn btn-primary" type="submit" name="btn" "/></td>
			</tr>
		
		</table>
		
	</form>

</body>
</html>